IRCBot::Plugin.define "help" do
	help_string "Shows help for plugins."
	def command(user,target,message,usermask)
		if message.empty? then
			plugins = []
			IRCBot::Plugin.registered_plugins.each do |alf|
				plugins << alf[0] if alf[1].methods.include?('command') or alf[1].methods.include?('privmsg_function') and alf[1].help_string
			end
			plugins.sort!
			privmsg(target,"I have help for the following plugins: #{plugins.join(", ")}")
			privmsg(target,"Type \"#{$ircbot.config['global']['command_identifier']}help <plugin>\" for help.")
		else
			if get_plugin(message) and get_plugin(message).help_string then
				privmsg(target,IRCBot::Plugin.registered_plugins[message].help_string)
			elsif get_plugin(message) and !get_plugin(message).help_string then
				privmsg(target,"That plug-in doesn't have help.")
			else
				privmsg(target,"No such plugin.")
			end
		end
	end
end
